﻿@using WebApp.Common.EFQuery;
@using System.Data;

@{
    
}

<!-- content-header -->
<div class="content-header">
    <h2><i class="icofont-home"></i> 商品管理</h2>
</div><!-- /content-header -->
<!-- content-breadcrumb 面包屑 -->
<div class="content-breadcrumb">
    <!--breadcrumb-->
    <ul class="breadcrumb">
        <li><a href="index.html"><i class="icofont-home"></i> 首页</a><span class="divider">&rsaquo;</span></li>
        <li><a href="index.html"><i class="icofont-home"></i> 数据录入</a><span class="divider">&rsaquo;</span></li>
        <li class="active">商品管理</li>
    </ul><!--/breadcrumb-->
</div><!-- /content-breadcrumb -->
<!-- content-body -->
<div class="content-body" layouth="250">
    <div class="box corner-all">
        <!--box header-->
        <div class="box-header grd-white color-silver-dark corner-top">
            <div class="header-control">
                <a data-box="collapse"><i class="icofont-caret-up"></i></a>
            </div>
            <span>查询商品</span>
        </div><!--/box header-->
        <!--box body-->
        <div class="box-body corner-bottom">
            <table>
                <tr>
                    <td>商品名称：</td>
                    <td>
                        <!--placeholder没起作用-->
                        
                    </td>
                    <td><label for="lk_s_Name">售价：</label></td>
                    <td>
                        
                        &nbsp;~&nbsp;
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        <button type="button" class="btn btn-primary" id="btnSearch">查詢</button>
                    </td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    </div>

    <div class="box corner-all" layouth="400">
        <!--这里不要写class="easyui-datagrid",$.ready里会做初始化-->
        <table id="list_data"
               data-options="url:'@Url.Action("VegList", "Home")',method:'post',rownumbers:true,singleSelect:true,pagination:true,sortName:'Id',sortOrder:'asc',fit:true,fitColumns:true,queryParams:getQueryParams()">
            <thead>
                <tr>
                    <th data-options="field:'Name'" width="150">名称</th>
                    <th data-options="field:'MainVeg'" width="200">备注</th>
                    <th data-options="field:'Price',align:'right'" width="100">售价</th>
                    <th data-options="field:'Integral',align:'right'" width="100">积分</th>
                    <th data-options="field:'Weight'" width="150">规格</th>
                    <th data-options="field:'Edible'" width="150">食用方式</th>
                </tr>
            </thead>
        </table>
    </div>

</div><!--/content-body -->
@section scripts{
<script type="text/javascript">
    $().ready(function () {
        $("#btnSearch").on("click", function () {
            $datagrid.datagrid('options').queryParams = getQueryParams();
            $datagrid.datagrid('load');
        });
    });

    function getQueryParams() {
        var inputs = ["lk_s_Name", "ge_d_Price", "le_d_Price"];
        var query = {};

        for (var i = 0; i < inputs.length; i++) {
            var inputname = inputs[i];
            var $input = $("#" + inputname);
            //控件没找到，忽略
            if ($input.length == 0) continue;

            var inputVal = $input.val();
            //未输入值，忽略
            if (inputVal.length == 0) continue;

            query[inputname] = inputVal;
        }
        return query;
    }
</script>        
    
}

